package org.example.smartEducationBackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.smartEducationBackend.entity.DTO.CommentDTO;
import org.example.smartEducationBackend.entity.POJO.Comment;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    @Select("SELECT b.nick_name,b.user_name,a.comment,b.avatar,a.rating,a.`data` FROM `comment` a LEFT JOIN user_accounts b ON a.user_id=b.user_id WHERE a.video_id = #{id}")
    List<CommentDTO> selectByVideo_id(Integer id);

}
